//
// Created by 高森森 on 2022/2/7.
//

#ifndef LEETCODE_SOLUTION21_H
#define LEETCODE_SOLUTION21_H

#include <iostream>
#include <vector>
#include <queue>
#include<unordered_map>
#include <memory.h>

using namespace std;
class Solution21 {
public:
    vector<int> findSmallestSetOfVertices(int n, vector<vector<int>>& edges) {
        bool hasInDegree[n];
        vector<int>res;
        memset(hasInDegree, false, sizeof(hasInDegree));
        for(auto edge:edges){
            hasInDegree[edge[1]]= true;
        }
        for(int i=0;i<n;i++){
            if(hasInDegree[i]== false){
                res.push_back(i);
            }
        }
        return res;
    }
};


#endif //LEETCODE_SOLUTION21_H
